package net.sudot.commons.security;

import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * JWT用户认证令牌
 *
 * @author tangjialin on 2018-04-06.
 */
public class JwtUserAuthenticationToken extends UsernamePasswordToken {
    /** 用户类型 */
    private Class<?> userClass;
    private Jwt.Payload payload;

    public JwtUserAuthenticationToken(Class<?> userClass, Jwt.Payload payload, String password, boolean rememberMe, String host) {
        super(payload.getSub(), password, rememberMe, host);
        this.userClass = userClass;
        this.payload = payload;
    }

    public Class<?> getUserClass() {
        return userClass;
    }

    public JwtUserAuthenticationToken setUserClass(Class<?> userClass) {
        this.userClass = userClass;
        return this;
    }

    public Jwt.Payload getPayload() {
        return payload;
    }

    public JwtUserAuthenticationToken setPayload(Jwt.Payload payload) {
        this.payload = payload;
        return this;
    }
}